package com.jdz.ebcf.socketio.handler;

import com.corundumstudio.socketio.AckRequest;
import com.corundumstudio.socketio.SocketIOClient;
import com.corundumstudio.socketio.SocketIOServer;
import com.corundumstudio.socketio.annotation.OnEvent;
import com.jdz.ebcf.socketio.message.MyMessage;
import com.jdz.ebcf.socketio.message.Room;
import com.jdz.ebcf.socketio.message.User;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.concurrent.ConcurrentHashMap;

/**
 * Created by wangkun23 on 2016/7/22.
 */
@Component
public class MessageHandler {

    private static final Logger logger = LoggerFactory.getLogger(ChatMessageHandler.class);

    @Autowired
    private SocketIOServer server;

    public static final ConcurrentHashMap<String, Room> rooms = new ConcurrentHashMap<String, Room>();

    @OnEvent(value = "getmessage")
    public void actite(SocketIOClient client, MyMessage message, AckRequest ackRequest) {
    	System.out.println(message.getContext());
    	client.sendEvent("mymessage", message.getContext());
    }

}
